$(function () {
    let orderList = [];
    let vue = new Vue({
        el: "#app",
        data: {
            shopOrder:orderList
        },
        methods: {
            receive: function (sOrderId) {
                $.ajax({
                    url: '/merchant/received',
                    data: {'id':sOrderId,"status":2},
                    type: 'post',
                    dataType: 'json',
                    success: function (result) {
                        layer.msg("客户已接待");
                    }
                })
            },
            miss: function (sOrderId) {
                $.ajax({
                    url: '/merchant/received',
                    data: {'id':sOrderId,"status":3},
                    type: 'post',
                    dataType: 'json',
                    success: function (result) {
                        layer.msg("客户已违约");
                    }
                })
            }
        }
    });
    $.ajax({
        url: '/merchant/orderList',
        type: 'post',
        dataType: 'json',
        success: function (result) {
            for(let i=0;i<result.length;i++){
                let service = {
                    "id":result[i].mid,
                    "date":result[i].adate,
                    "time":result[i].atime,
                    "status":result[i].mstatus,
                    "user":result[i].user.nickname,
                    "address":result[i].user.phone
                };
                orderList.push(service);
            }
        }
    })
});